package com.goodsogood.union.auth.conf;

/**
 * 数据源配置
 * 
 * @author liuy
 *
 */
public class DataSourceConfiger {
    private static class InstanceHolder {  
        private static final DataSourceConfiger INSTANCE = new DataSourceConfiger();  
    }  
    public static final DataSourceConfiger getInstance() {  
        return InstanceHolder.INSTANCE;
    }
    private DataSourceConfiger (){
        this.dataSourceClassName = ConfigLoader.getValue("dataSource.className");
        this.dataSourceUrl = ConfigLoader.getValue("dataSource.url");
        this.dataSourceUser = ConfigLoader.getValue("dataSource.user");
        this.dataSourcePwd = ConfigLoader.getValue("dataSource.password");
        this.dataSourceCachePrepStmts = ConfigLoader.getValue("dataSource.cachePrepStmts");
        this.dataSourcePrepStmtCacheSize = ConfigLoader.getValue("dataSource.prepStmtCacheSize");
        this.dataSourcePrepStmtCacheSqlLimit = ConfigLoader.getValue("dataSource.prepStmtCacheSqlLimit");
        this.dataSourceMaximumPoolSize = ConfigLoader.getValue("dataSource.maximumPoolSize");
        this.dataSourceIdleTimeout = ConfigLoader.getValue("dataSource.idleTimeout");
    }

    private String dataSourceClassName;
    private String dataSourceUrl;
    private String dataSourceUser;
    private String dataSourcePwd;
    private String dataSourceCachePrepStmts;
    private String dataSourcePrepStmtCacheSize;
    private String dataSourcePrepStmtCacheSqlLimit;
    private String dataSourceMaximumPoolSize;
    private String dataSourceIdleTimeout;
    
    public String getDataSourceClassName() {
        return dataSourceClassName == null ? "" : dataSourceClassName;
    }
    public String getDataSourceUrl() {
        return dataSourceUrl == null ? "" : dataSourceUrl;
    }
    public String getDataSourceUser() {
        return dataSourceUser == null ? "" : dataSourceUser;
    }
    public String getDataSourcePwd() {
        return dataSourcePwd == null ? "" : dataSourcePwd;
    }
    public String getDataSourceCachePrepStmts() {
        return dataSourceCachePrepStmts == null ? "" : dataSourceCachePrepStmts;
    }
    public String getDataSourcePrepStmtCacheSize() {
        return dataSourcePrepStmtCacheSize == null ? "" : dataSourcePrepStmtCacheSize;
    }
    public String getDataSourcePrepStmtCacheSqlLimit() {
        return dataSourcePrepStmtCacheSqlLimit == null ? "" : dataSourcePrepStmtCacheSqlLimit;
    }
    public String getDataSourceMaximumPoolSize() {
        return dataSourceMaximumPoolSize == null ? "" : dataSourceMaximumPoolSize;
    }
    public String getDataSourceIdleTimeout() {
        return dataSourceIdleTimeout == null ? "" : dataSourceIdleTimeout;
    }
}
